package org.feifei.product.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.feifei.basic.domain.BaseDomain;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Random;

/**
 * @author forever
 * @Description: 实体类 Product
 * @date 2021/12/19 22:04
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Getter
@Setter
@EqualsAndHashCode
public class Product extends BaseDomain {

    @ApiModelProperty("商品名称")
    private String name;
    @ApiModelProperty("商品图片")
    private String resources;
    @ApiModelProperty("成本价")
    private BigDecimal costprice;
    @ApiModelProperty("售价")
    private BigDecimal saleprice;
    @ApiModelProperty("下架时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date offsaletime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty("上架时间")
    private Date onsaletime;
    @ApiModelProperty("状态 -1取消 0未 1已支付")
    private Integer state;
    @ApiModelProperty("订单创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createtime = new Date();
    @ApiModelProperty("购买数量")
    private Long salecount = Long.valueOf(new Random().nextInt(100));

    @ApiModelProperty("注入的商品详情")
    private ProductDetail detail;

}
